﻿using System;

namespace TierraReborn
{
    public class MachineInstruction
    {
        //In addition to mutations, the execution of Tierran instructions is flawed
        //at a low rate.  For most of the 32 instructions, the result is off by plus
        //or minus one at some low frequency.  For example, the increment instruction
        //normally adds one to its register, but it sometimes adds two or zero.  The
        //bit flipping instruction normally flips the low order bit, but it sometimes
        //flips the next higher bit or no bit.  The shift left instruction normally
        //shifts all bits one bit to the left, but it sometimes shifts left by two
        //bits, or not at all.  In this way, the behavior of the Tierran instructions
        //is probabilistic, not fully deterministic.


        // 32 instructions
        public enum InstructionEnum
        {
            nop_0 = 0x00,
            nop_1 = 0x01,
            or1 = 0x02,
            sh1 = 0x03,
            zero = 0x04,
            if_cz = 0x05,
            sub_ab = 0x06,
            sub_ac = 0x07,
            inc_a = 0x08,
            inc_b = 0x09,
            dec_c = 0x0a,
            inc_c = 0x0b,
            push_ax = 0x0c,
            push_bx = 0x0d,
            push_cx = 0x0e,
            push_dx = 0x0f,
            pop_ax = 0x10,
            pop_bx = 0x11,
            pop_cx = 0x12,
            pop_dx = 0x13,
            jmp = 0x14,
            jmpb = 0x15,
            call = 0x16,
            ret = 0x17,
            mov_cd = 0x18,
            mov_ab = 0x19,
            move_iab = 0x1a,
            adr = 0x1b,
            adrb = 0x1c,
            adrf = 0x1d,
            mal = 0x1e,
            divide = 0x1f
        }

        
    }
}
